package com.zzyl.controller.customer;


import com.zzyl.base.PageResponse;
import com.zzyl.base.ResponseResult;
import com.zzyl.entity.NursingProject;
import com.zzyl.service.NursingProjectService;
import com.zzyl.vo.NursingProjectVo;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/customer/orders")
public class CustomerOrdersController {

    @Autowired
    private NursingProjectService nursingProjectService;


    @GetMapping("/project/page")
    @ApiOperation(value = "分页查询护理项目", notes = "根据页码、每页数量、名称和状态分页查询护理项目列表")

    public ResponseResult<NursingProject> selectByPage(
            @ApiParam(value = "页码", required = true) @RequestParam Integer pageNum,
            @ApiParam(value = "每页数量", required = true) @RequestParam Integer pageSize,
            @ApiParam(value = "名称") @RequestParam(required = false) String name,
            @ApiParam(value = "状态") @RequestParam(required = false) Integer status) {

        PageResponse<NursingProjectVo> nursingProjectResponseResult = nursingProjectService.selectByPage(pageNum, pageSize, name, status);
        return ResponseResult.success(nursingProjectResponseResult);
    }

    @GetMapping("/project/{id}")
    @ApiOperation(value = "根据ID查询护理项目详情", notes = "通过护理项目的ID获取详细信息")

    public ResponseResult<NursingProject> selectNursingProjectById(@PathVariable @ApiParam(value = "护理项目ID", required = true) Long id) {
        NursingProjectVo nursingProjectVo = nursingProjectService.selectNursingProjectById(id);
        return ResponseResult.success(nursingProjectVo);
    }
}
